package com.spic.business.informatization.accounting.domain;

import com.spic.business.two.tickets.electricfirst.domain.ElectricFirstTicket;
import com.spic.business.two.tickets.electricsecond.domain.ElectricSecondTicket;
import com.spic.business.two.tickets.emergencyrepai.domain.EmergencyRepair;
import com.spic.business.two.tickets.firstfire.domain.FirstClassFireTicket;
import com.spic.business.two.tickets.maintenance.domain.MaintenanceTicket;
import com.spic.business.two.tickets.operate.domain.OperateTicket;
import com.spic.business.two.tickets.secondclassfire.domain.SecondClassFireTicket;
import com.spic.business.two.tickets.thirdfire.domain.ThirdClassFireTicket;
import com.spic.common.core.annotation.Excel;
import com.spic.common.core.utils.SecurityUtils;
import com.spic.common.core.web.domain.BaseEntity;
import lombok.Data;

/**
 * 班前班后会工作组对象 meeting_working_group
 *
 * @author spic
 * @date 2021-11-04
 */
@Data
public class MeetingWorkingGroup extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 班前班后工作组id */
    private Long id;

    /** 班前班后id */
    @Excel(name = "班前班后id")
    private Long meetingAccountingId;

    /** 组成员 */
    @Excel(name = "组成员")
    private String groupMembers;

    /** 是否需要票据 */
    @Excel(name = "是否需要票据")
    private String isRequiredTicket;

    /** 票据类型 */
    @Excel(name = "票据类型")
    private String ticketType;

    /** 票据主键id */
    @Excel(name = "票据主键id")
    private Long ticketId;

    /** 补充信息 */
    @Excel(name = "补充信息")
    private String supplementaryInformation;

    public boolean needTicket(){

        return "Y".equals(this.getIsRequiredTicket()) && this.getTicketType() != null;
    }

    public ElectricFirstTicket convertToElectricFirstTicket(){
        ElectricFirstTicket ticket = new ElectricFirstTicket();
        ticket.setWorkUnit(SecurityUtils.getDeptId());
        ticket.setWorkGroup(this.getGroupMembers());
        ticket.setWorkPrincipal(String.valueOf(SecurityUtils.getUserId()));
        return ticket;
    }

    public ElectricSecondTicket convertToElectricSecondTicket(){
        ElectricSecondTicket ticket = new ElectricSecondTicket();
        ticket.setWorkUnit(SecurityUtils.getDeptId()+"");
        ticket.setWorkGroup(this.getGroupMembers());
        return ticket;
    }

    public OperateTicket convertToOperateTicket(){
        OperateTicket ticket = new OperateTicket();
        ticket.setOperator(this.getGroupMembers());
        return ticket;
    }

    public EmergencyRepair convertToEmergencyRepair(){
        EmergencyRepair ticket = new EmergencyRepair();
        ticket.setWorkGroup(this.getGroupMembers());
        return ticket;
    }

    public FirstClassFireTicket convertToFirstClassFireTicket()
    {
        FirstClassFireTicket ticket = new FirstClassFireTicket();
        ticket.setWorkUnit(SecurityUtils.getDeptId()+"");
        return ticket;
    }

    public SecondClassFireTicket convertToSecondClassFireTicket(){
        SecondClassFireTicket ticket = new SecondClassFireTicket();
        ticket.setWorkUnit(SecurityUtils.getDeptId()+"");
        return ticket;
    }

    public ThirdClassFireTicket convertToThirdClassFireTicket(){
        ThirdClassFireTicket ticket = new ThirdClassFireTicket();
        ticket.setWorkUnit(SecurityUtils.getDeptId()+"");
        return ticket;
    }

    public MaintenanceTicket convertToMaintenanceTicket() {
        MaintenanceTicket ticket = new MaintenanceTicket();
        ticket.setWorkUnit(SecurityUtils.getDeptId()+"");
        return ticket;
    }


}
